import request from '@/utils/request'
import type { ApiResponse } from '../index'

// 订单相关接口
export const orderApi = {
  // 获取订单列表
  getList(params?: { page?: number; status?: string }) {
    return request.get<ApiResponse>('/user/orders', { params })
  },
  
  // 获取订单详情
  getDetail(id: number) {
    return request.get<ApiResponse>(`/user/orders/${id}`)
  },
  
  // 创建订单
  create(data: {
    groupBuyId: number
    quantity: number
  }) {
    return request.post<ApiResponse>('/user/orders', data)
  },
  
  // 取消订单
  cancel(id: number) {
    return request.post<ApiResponse>(`/user/orders/${id}/cancel`)
  }
} 